import { createRouter, createWebHistory } from "vue-router";
import homeRouter from "../views/home/router";
console.log(...homeRouter);
//打印数组中的六个对象

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/index",
    name: "Index",
    component: () => import("../views/Index.vue"),
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/home/Home.vue"),
      },
    ],
  },
  ...homeRouter,
  //把这个数组展开在这个位置
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/personalCenter/Login.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
